-module(smb_server).
-compile(export_all).



start() ->
	%% {ok, _TabUser} = dets:open_file("tab_user.dat").
	test_adduser().








test_adduser() ->
	{ok, TabUser} = dets:open_file('tab_user.dat', [{file, 'tab_user.dat'}]),
	ok = dets:insert(TabUser, {switch, 871218}),
	ok = dets:insert(TabUser, {wy, 87}),
	ok = dets:insert(TabUser, {wy, 12}),
	ok = dets:insert(TabUser, {wy, 18}),
	dets:close(TabUser),
	{ok, TabUser}.

test_getuser(User, Pwd) ->
	{ok, TabUser} = dets:open_file("tab_user.dat"),
	%%[{User, Pwd}] = dets:lookup(TabUser, User),
	case dets:lookup(TabUser, User) of
		[{User, Pwd}] -> Res = ok;
		_Any -> Res = {error, enot_mattch}
	end,
	dets:close(TabUser),
	Res.

